#ifndef  __ZeroSystem_H__
#define  __ZeroSystem_H__

#include "ZeroPopulation.h"
#include "ZeroEnvironment.h"
#include "ZeroThread.h"
#include "ZeroMessage.h"

class ZeroSystem {
public:
	ZeroSystem(ZeroPopulation *zpop, ZeroEnvironment *zenv);
	~ZeroSystem();

	void start();
	void stop();
	void cleanup();

	static void* Run(void* data);

	ZeroPopulation* getZPop();
	ZeroEnvironment* getZEnv();

	enum ZMsgType_e {
		MSGTYPE_ZSysMain = 0,
	};

	enum ZSysMsg_e {
		ZMSG_None = 0,
		ZMSG_Stop,
		ZMSG_NewEnv,
	};

	ZSysMsg_e getMessage(ZMsgType_e msgType);
	void sendMessage(ZMsgType_e msgType, ZSysMsg_e msg);

	bool probCrossover();
	bool probCopyMutation();
	bool probIsometric();

	void dumpStatus();
private:
	ZeroPopulation *mZPop;
	ZeroEnvironment *mZEnv;

	ZeroThread *mZSysThread;

	ZeroMessage *mMainMsg;
	bool mIsRunning;
};

#endif /*__ZeroSystem*/
